# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb762738c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb762750c>}
nname: 0
n 0(None)[return self.get_item_list(list_name)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75abf0c>}
nname: 239
n 239(None)[self._browse_items()
self.countdown = range(1, 3)
]:
	i: 53(AL), 238()
	o: 

nname: 238
n 238(None)[]:
	i: 197(AF), 207()
	o: 239()

nname: 207
n 207(None)[for c in self.available_choices:
def self._getitems_keywords[c](list_name=c):
	return self.get_item_list(list_name)

]:
	i: 197(for)
	o: 238()

nname: 197
n 197(None)[]:
	i: 53(loop)
	o: 207(for), 238(AF)

nname: 53
n 53(None)[self.eventhandler = eventhandler
self.action = action
self.cancel_action = cancel_action
self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
self.message_window = TextWindow(_('Wrong PIN code'))
]:
	i: 0(t), 43()
	o: 197(loop), 239(AL)

nname: 43
n 43(None)[]:
	i: 0(f)
	o: 53()

nname: 0
n 0(eventhandler)[Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
]:
	i: 
	o: 43(f), 53(t)

nname: 238
n 238(None)[self._browse_items()
self.countdown = range(1, 3)
]:
	i: 197()
	o: 

nname: 197
n 197(None)[for c in self.available_choices:
	def self._getitems_keywords[c](list_name=c):
		return self.get_item_list(list_name)

]:
	i: 0(loop)
	o: 238()

nname: 0
n 0(None)[Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
if not eventhandler:
	pass
self.eventhandler = eventhandler
self.action = action
self.cancel_action = cancel_action
self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
self.message_window = TextWindow(_('Wrong PIN code'))
]:
	i: 
	o: 197(loop)

nname: 238
n 238(None)[self._browse_items()
self.countdown = range(1, 3)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
if not eventhandler:
	pass
self.eventhandler = eventhandler
self.action = action
self.cancel_action = cancel_action
self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
self.message_window = TextWindow(_('Wrong PIN code'))
for c in self.available_choices:
	def self._getitems_keywords[c](list_name=c):
		return self.get_item_list(list_name)

]:
	i: 
	o: 238()

nname: 0
n 0(None)[Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
if not eventhandler:
	pass
self.eventhandler = eventhandler
self.action = action
self.cancel_action = cancel_action
self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
self.message_window = TextWindow(_('Wrong PIN code'))
for c in self.available_choices:
	def self._getitems_keywords[c](list_name=c):
		return self.get_item_list(list_name)

self._browse_items()
self.countdown = range(1, 3)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ab36c>}
nname: 130
n 130(None)[]:
	i: 0(AL), 129()
	o: 

nname: 129
n 129(None)[]:
	i: 54(AF), 77()
	o: 130()

nname: 77
n 77(None)[for browsed, list_name in zip(items, self.available_choices[1:]):
self.set_items(browsed.browse(), list_name)
self.get_item_list(list_name).cyclic = True
]:
	i: 54(for)
	o: 129()

nname: 54
n 54(None)[]:
	i: 0(loop)
	o: 77(for), 129(AF)

nname: 0
n 0(None)[items = self.main_items[rank].browse()
prompt = self.prompt_items[rank]
self.set_items([prompt], 'options_list')
]:
	i: 
	o: 54(loop), 130(AL)

nname: 130
n 130(None)[]:
	i: 77()
	o: 

nname: 77
n 77(None)[for browsed, list_name in zip(items, self.available_choices[1:]):
	self.set_items(browsed.browse(), list_name)
	self.get_item_list(list_name).cyclic = True
]:
	i: 0(for)
	o: 130()

nname: 0
n 0(None)[items = self.main_items[rank].browse()
prompt = self.prompt_items[rank]
self.set_items([prompt], 'options_list')
]:
	i: 
	o: 77(for)

nname: 130
n 130(None)[]:
	i: 0()
	o: 

nname: 0
n 0(None)[items = self.main_items[rank].browse()
prompt = self.prompt_items[rank]
self.set_items([prompt], 'options_list')
for browsed, list_name in zip(items, self.available_choices[1:]):
	self.set_items(browsed.browse(), list_name)
	self.get_item_list(list_name).cyclic = True
]:
	i: 
	o: 130()

nname: 0
n 0(None)[items = self.main_items[rank].browse()
prompt = self.prompt_items[rank]
self.set_items([prompt], 'options_list')
for browsed, list_name in zip(items, self.available_choices[1:]):
	self.set_items(browsed.browse(), list_name)
	self.get_item_list(list_name).cyclic = True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7627b6c>}
nname: 43
n 43(None)[]:
	i: 15(), 29()
	o: 

nname: 29
n 29(None)[Menu.focus_previous(self)
]:
	i: 0(f)
	o: 43()

nname: 15
n 15(None)[self.hide()
]:
	i: 0(t)
	o: 43()

nname: 0
n 0(self.active_list == 'main_list')[]:
	i: 
	o: 15(t), 29(f)

nname: 0
n 0(None)[if self.active_list == 'main_list':
	self.hide()
else:
	Menu.focus_previous(self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb762770c>}
nname: 145
n 145(None)[]:
	i: 12(), 107(), 126()
	o: 

nname: 126
n 126(None)[self._browse_items()
self.active_list = 'main_list'
]:
	i: 40(), 124(AE)
	o: 145()

nname: 124
n 124(None)[]:
	i: 97(f)
	o: 126(AE)

nname: 107
n 107(None)[self.cancel()
]:
	i: 97(t)
	o: 145()

nname: 97
n 97(<dummy_ex3> EXC_MATCH IndexError)[]:
	i: 36(except)
	o: 107(t), 124(f)

nname: 40
n 40(None)[remain = self.countdown.pop()
self.message_window.show()
Task(self.message_window.hide).start(2)
]:
	i: 36(try)
	o: 126()

nname: 36
n 36(None)[]:
	i: 0(f)
	o: 40(try), 97(except)

nname: 12
n 12(None)[self.hide()
self.action()
]:
	i: 0(t)
	o: 145()

nname: 0
n 0(selection.check_entered_value())[]:
	i: 
	o: 12(t), 36(f)

nname: 145
n 145(None)[]:
	i: 12(), 107(), 126(), 97(f)
	o: 

nname: 107
n 107(None)[self.cancel()
]:
	i: 97(t)
	o: 145()

nname: 97
n 97(<dummy_ex3> EXC_MATCH IndexError)[]:
	i: 36(except)
	o: 107(t), 145(f)

nname: 126
n 126(None)[self._browse_items()
self.active_list = 'main_list'
]:
	i: 40(), 124(AE)
	o: 145()

nname: 40
n 40(None)[remain = self.countdown.pop()
self.message_window.show()
Task(self.message_window.hide).start(2)
]:
	i: 36(try)
	o: 126()

nname: 36
n 36(None)[]:
	i: 0(f)
	o: 40(try), 97(except)

nname: 12
n 12(None)[self.hide()
self.action()
]:
	i: 0(t)
	o: 145()

nname: 0
n 0(selection.check_entered_value())[]:
	i: 
	o: 12(t), 36(f)

nname: 145
n 145(None)[]:
	i: 12(), 97()
	o: 

nname: 97
n 97(None)[except IndexError:
	self.cancel()
else:
	self._browse_items()
	self.active_list = 'main_list'
]:
	i: 36()
	o: 145()

nname: 36
n 36(None)[try:
	remain = self.countdown.pop()
	self.message_window.show()
	Task(self.message_window.hide).start(2)
]:
	i: 0(f)
	o: 97()

nname: 12
n 12(None)[self.hide()
self.action()
]:
	i: 0(t)
	o: 145()

nname: 0
n 0(selection.check_entered_value())[]:
	i: 
	o: 12(t), 36(f)

nname: 145
n 145(None)[]:
	i: 12(), 36()
	o: 

nname: 36
n 36(None)[try:
	remain = self.countdown.pop()
	self.message_window.show()
	Task(self.message_window.hide).start(2)
except IndexError:
	self.cancel()
else:
	self._browse_items()
	self.active_list = 'main_list'
]:
	i: 0(f)
	o: 145()

nname: 12
n 12(None)[self.hide()
self.action()
]:
	i: 0(t)
	o: 145()

nname: 0
n 0(selection.check_entered_value())[]:
	i: 
	o: 12(t), 36(f)

nname: 0
n 0(None)[if selection.check_entered_value():
	self.hide()
	self.action()
else:
	try:
		remain = self.countdown.pop()
		self.message_window.show()
		Task(self.message_window.hide).start(2)
	except IndexError:
		self.cancel()
	else:
		self._browse_items()
		self.active_list = 'main_list'
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7627b0c>}
nname: 0
n 0(None)[self.cancel_action()
self.hide()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76275ec>}
nname: 6
n 6(None)[__doc__ = "\n    This Menu permits to check that entered secret code (by user) is the\n    same as the config's one.\n    The user has 3 tries to enter the good code\n    "
def __init__(self, name, action=(lambda : None), cancel_action=(lambda : None), eventhandler=None, type='secret_code', **kw):
	Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
	if not eventhandler:
		pass
	self.eventhandler = eventhandler
	self.action = action
	self.cancel_action = cancel_action
	self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
	self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
	self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
	self.message_window = TextWindow(_('Wrong PIN code'))
	for c in self.available_choices:
		def self._getitems_keywords[c](list_name=c):
			return self.get_item_list(list_name)

	self._browse_items()
	self.countdown = range(1, 3)

def _browse_items(self, rank=0):
	items = self.main_items[rank].browse()
	prompt = self.prompt_items[rank]
	self.set_items([prompt], 'options_list')
	for browsed, list_name in zip(items, self.available_choices[1:]):
		self.set_items(browsed.browse(), list_name)
		self.get_item_list(list_name).cyclic = True

def focus_previous(self):
	if self.active_list == 'main_list':
		self.hide()
	else:
		Menu.focus_previous(self)

def _set_options_list(self, selection, keep_selection=False):
	if selection.check_entered_value():
		self.hide()
		self.action()
	else:
		try:
			remain = self.countdown.pop()
			self.message_window.show()
			Task(self.message_window.hide).start(2)
		except IndexError:
			self.cancel()
		else:
			self._browse_items()
			self.active_list = 'main_list'

def cancel(self):
	self.cancel_action()
	self.hide()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7626f8c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7626e8c>}
nname: 0
n 0(None)[return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7626eec>}
nname: 0
n 0(None)[SecretCodeCheckMenu.__init__(self, name, action, cancel_action, eventhandler, type, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7626fec>}
nname: 6
n 6(None)[def __init__(self, name, action=(lambda : None), cancel_action=(lambda : None), eventhandler=None, type='full_screen_secret_code', **kw):
	SecretCodeCheckMenu.__init__(self, name, action, cancel_action, eventhandler, type, **kw)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76269ac>}
nname: 124
n 124(None)[]:
	i: 29(), 69(), 105(), 122(AE)
	o: 

nname: 122
n 122(None)[]:
	i: 95(f)
	o: 124(AE)

nname: 105
n 105(None)[win.hide()
]:
	i: 95(t)
	o: 124()

nname: 95
n 95(<dummy_ex3> EXC_MATCH IndexError)[]:
	i: 65(except)
	o: 105(t), 122(f)

nname: 69
n 69(None)[self.countdown.pop()
win.text = ''
]:
	i: 65(try)
	o: 124()

nname: 65
n 65(None)[]:
	i: 0(f)
	o: 69(try), 95(except)

nname: 29
n 29(None)[self.action(*self.args, **self.kw)
win.hide()
]:
	i: 0(t)
	o: 124()

nname: 0
n 0(user_config['security']['answer'] == response)[response = win.text
]:
	i: 
	o: 29(t), 65(f)

nname: 124
n 124(None)[]:
	i: 29(), 95()
	o: 

nname: 95
n 95(None)[except IndexError:
	win.hide()
]:
	i: 65()
	o: 124()

nname: 65
n 65(None)[try:
	self.countdown.pop()
	win.text = ''
]:
	i: 0(f)
	o: 95()

nname: 29
n 29(None)[self.action(*self.args, **self.kw)
win.hide()
]:
	i: 0(t)
	o: 124()

nname: 0
n 0(user_config['security']['answer'] == response)[response = win.text
]:
	i: 
	o: 29(t), 65(f)

nname: 124
n 124(None)[]:
	i: 29(), 65()
	o: 

nname: 65
n 65(None)[try:
	self.countdown.pop()
	win.text = ''
except IndexError:
	win.hide()
]:
	i: 0(f)
	o: 124()

nname: 29
n 29(None)[self.action(*self.args, **self.kw)
win.hide()
]:
	i: 0(t)
	o: 124()

nname: 0
n 0(user_config['security']['answer'] == response)[response = win.text
]:
	i: 
	o: 29(t), 65(f)

nname: 0
n 0(None)[response = win.text
if user_config['security']['answer'] == response:
	self.action(*self.args, **self.kw)
	win.hide()
else:
	try:
		self.countdown.pop()
		win.text = ''
	except IndexError:
		win.hide()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7627dac>}
nname: 0
n 0(None)[self.action = action
self.args = args
self.kw = kw
self.countdown = range(1, 3)
def check_answer(win):
	response = win.text
	if user_config['security']['answer'] == response:
		self.action(*self.args, **self.kw)
		win.hide()
	else:
		try:
			self.countdown.pop()
			win.text = ''
		except IndexError:
			win.hide()

kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
kbd.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7627aec>}
nname: 6
n 6(None)[def __init__(self, action, *args, **args):
	self.action = action
	self.args = args
	self.kw = kw
	self.countdown = range(1, 3)
	def check_answer(win):
		response = win.text
		if user_config['security']['answer'] == response:
			self.action(*self.args, **self.kw)
			win.hide()
		else:
			try:
				self.countdown.pop()
				win.text = ''
			except IndexError:
				win.hide()

	kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
	kbd.show()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7626a8c>}
nname: 0
n 0(None)[self._new_response = win.text
win.hide()
self._set_new_values()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ab40c>}
nname: 0
n 0(None)[self._new_question = win.text
win.hide()
kbd = KeyboardWindow(title=_('Enter your answer'), confirm_action=set_new_answer)
self._connect_cancel_button(kbd)
kbd.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ab1ec>}
nname: 152
n 152(None)[]:
	i: 29(), 106(), 133(), 150(AE)
	o: 

nname: 150
n 150(None)[]:
	i: 123(f)
	o: 152(AE)

nname: 133
n 133(None)[win.hide()
]:
	i: 123(t)
	o: 152()

nname: 123
n 123(<dummy_ex3> EXC_MATCH IndexError)[]:
	i: 93(except)
	o: 133(t), 150(f)

nname: 106
n 106(None)[self.countdown.pop()
]:
	i: 93(try)
	o: 152()

nname: 93
n 93(None)[win.text = ''
]:
	i: 0(f)
	o: 106(try), 123(except)

nname: 29
n 29(None)[win.hide()
kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
self._connect_cancel_button(kbd)
kbd.show()
]:
	i: 0(t)
	o: 152()

nname: 0
n 0(user_config['security']['answer'] == response)[response = win.text
]:
	i: 
	o: 29(t), 93(f)

nname: 152
n 152(None)[]:
	i: 29(), 123()
	o: 

nname: 123
n 123(None)[except IndexError:
	win.hide()
]:
	i: 93()
	o: 152()

nname: 93
n 93(None)[win.text = ''
try:
	self.countdown.pop()
]:
	i: 0(f)
	o: 123()

nname: 29
n 29(None)[win.hide()
kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
self._connect_cancel_button(kbd)
kbd.show()
]:
	i: 0(t)
	o: 152()

nname: 0
n 0(user_config['security']['answer'] == response)[response = win.text
]:
	i: 
	o: 29(t), 93(f)

nname: 152
n 152(None)[]:
	i: 29(), 93()
	o: 

nname: 93
n 93(None)[win.text = ''
try:
	self.countdown.pop()
except IndexError:
	win.hide()
]:
	i: 0(f)
	o: 152()

nname: 29
n 29(None)[win.hide()
kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
self._connect_cancel_button(kbd)
kbd.show()
]:
	i: 0(t)
	o: 152()

nname: 0
n 0(user_config['security']['answer'] == response)[response = win.text
]:
	i: 
	o: 29(t), 93(f)

nname: 0
n 0(None)[response = win.text
if user_config['security']['answer'] == response:
	win.hide()
	kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
	self._connect_cancel_button(kbd)
	kbd.show()
else:
	win.text = ''
	try:
		self.countdown.pop()
	except IndexError:
		win.hide()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ad7ec>}
nname: 190
n 190(None)[self._connect_cancel_button(kbd)
kbd.show()
return None
]:
	i: 120(), 153()
	o: 

nname: 153
n 153(None)[kbd = KeyboardWindow(title=_('Enter your question.  \nIt will be asked if you lose your secret code'), confirm_action=set_new_question)
kbd.type = 'bigtitle_keyboard'
]:
	i: 0(f)
	o: 190()

nname: 120
n 120(None)[kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
]:
	i: 0(t)
	o: 190()

nname: 0
n 0(check)[self.countdown = range(1, 3)
self._new_question = None
self._new_response = None
self.end_action = end_action
self.end_action_args = end_action_args
self.end_action_kw = end_action_kw
def set_new_answer(win):
	self._new_response = win.text
	win.hide()
	self._set_new_values()

def set_new_question(win):
	self._new_question = win.text
	win.hide()
	kbd = KeyboardWindow(title=_('Enter your answer'), confirm_action=set_new_answer)
	self._connect_cancel_button(kbd)
	kbd.show()

def check_answer(win):
	response = win.text
	if user_config['security']['answer'] == response:
		win.hide()
		kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
		self._connect_cancel_button(kbd)
		kbd.show()
	else:
		win.text = ''
		try:
			self.countdown.pop()
		except IndexError:
			win.hide()

]:
	i: 
	o: 120(t), 153(f)

nname: 0
n 0(None)[self.countdown = range(1, 3)
self._new_question = None
self._new_response = None
self.end_action = end_action
self.end_action_args = end_action_args
self.end_action_kw = end_action_kw
def set_new_answer(win):
	self._new_response = win.text
	win.hide()
	self._set_new_values()

def set_new_question(win):
	self._new_question = win.text
	win.hide()
	kbd = KeyboardWindow(title=_('Enter your answer'), confirm_action=set_new_answer)
	self._connect_cancel_button(kbd)
	kbd.show()

def check_answer(win):
	response = win.text
	if user_config['security']['answer'] == response:
		win.hide()
		kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
		self._connect_cancel_button(kbd)
		kbd.show()
	else:
		win.text = ''
		try:
			self.countdown.pop()
		except IndexError:
			win.hide()

if check:
	kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
else:
	kbd = KeyboardWindow(title=_('Enter your question.  \nIt will be asked if you lose your secret code'), confirm_action=set_new_question)
	kbd.type = 'bigtitle_keyboard'
self._connect_cancel_button(kbd)
kbd.show()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ab68c>}
nname: 98
n 98(None)[return None
]:
	i: 71(), 97()
	o: 

nname: 97
n 97(None)[]:
	i: 0(f)
	o: 98()

nname: 71
n 71(None)[self.end_action(*self.end_action_args, **self.end_action_kw)
]:
	i: 0(t)
	o: 98()

nname: 0
n 0(self.end_action is not None)[_question = self._new_question
_response = self._new_response
user_config['security']['question'] = _question
user_config['security']['answer'] = _response
user_config.save()
]:
	i: 
	o: 71(t), 97(f)

nname: 0
n 0(None)[_question = self._new_question
_response = self._new_response
user_config['security']['question'] = _question
user_config['security']['answer'] = _response
user_config.save()
if self.end_action is not None:
	self.end_action(*self.end_action_args, **self.end_action_kw)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75ab3ac>}
nname: 6
n 6(None)[__doc__ = "\n    This class sets up the algorithm for modify the Q/A in setup :\n        - check the current answer (if 'check' parameters is True)\n        - ask the new question\n        - ask the new answer\n        - then if no cancel, record the new question and the new answer\n    "
def __init__(self, check=True, end_action=None, end_action_args=(), end_action_kw={}):
	self.countdown = range(1, 3)
	self._new_question = None
	self._new_response = None
	self.end_action = end_action
	self.end_action_args = end_action_args
	self.end_action_kw = end_action_kw
	def set_new_answer(win):
		self._new_response = win.text
		win.hide()
		self._set_new_values()

	def set_new_question(win):
		self._new_question = win.text
		win.hide()
		kbd = KeyboardWindow(title=_('Enter your answer'), confirm_action=set_new_answer)
		self._connect_cancel_button(kbd)
		kbd.show()

	def check_answer(win):
		response = win.text
		if user_config['security']['answer'] == response:
			win.hide()
			kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
			self._connect_cancel_button(kbd)
			kbd.show()
		else:
			win.text = ''
			try:
				self.countdown.pop()
			except IndexError:
				win.hide()

	if check:
		kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
	else:
		kbd = KeyboardWindow(title=_('Enter your question.  \nIt will be asked if you lose your secret code'), confirm_action=set_new_question)
		kbd.type = 'bigtitle_keyboard'
	self._connect_cancel_button(kbd)
	kbd.show()
	return None

def _set_new_values(self):
	_question = self._new_question
	_response = self._new_response
	user_config['security']['question'] = _question
	user_config['security']['answer'] = _response
	user_config.save()
	if self.end_action is not None:
		self.end_action(*self.end_action_args, **self.end_action_kw)
	return None

_on_cancel_firstboot = staticmethod()
_connect_cancel_button = staticmethod()
]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7626c6c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from .core import Menu
from pygui.item.core import Item
from pygui.eventmanager.menus import SecretCodeMenuEventHandler
from pygui.item.parameters.generalsetup.securitysetup import SecretCodeUserConfigSetupItem, SecretCodeCheckConfigSetupItem
from pygui.window import KeyboardWindow
from pygui.config import user_config
from pygui.shared import pygui_globs
from pygui.window import TextWindow
from peewee.notifier import Task
class SecretCodeCheckMenu(Menu):
	__doc__ = "\n    This Menu permits to check that entered secret code (by user) is the\n    same as the config's one.\n    The user has 3 tries to enter the good code\n    "
	def __init__(self, name, action=(lambda : None), cancel_action=(lambda : None), eventhandler=None, type='secret_code', **kw):
		Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
		if not eventhandler:
			pass
		self.eventhandler = eventhandler
		self.action = action
		self.cancel_action = cancel_action
		self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
		self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
		self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
		self.message_window = TextWindow(_('Wrong PIN code'))
		for c in self.available_choices:
			def self._getitems_keywords[c](list_name=c):
				return self.get_item_list(list_name)

		self._browse_items()
		self.countdown = range(1, 3)

	def _browse_items(self, rank=0):
		items = self.main_items[rank].browse()
		prompt = self.prompt_items[rank]
		self.set_items([prompt], 'options_list')
		for browsed, list_name in zip(items, self.available_choices[1:]):
			self.set_items(browsed.browse(), list_name)
			self.get_item_list(list_name).cyclic = True

	def focus_previous(self):
		if self.active_list == 'main_list':
			self.hide()
		else:
			Menu.focus_previous(self)

	def _set_options_list(self, selection, keep_selection=False):
		if selection.check_entered_value():
			self.hide()
			self.action()
		else:
			try:
				remain = self.countdown.pop()
				self.message_window.show()
				Task(self.message_window.hide).start(2)
			except IndexError:
				self.cancel()
			else:
				self._browse_items()
				self.active_list = 'main_list'

	def cancel(self):
		self.cancel_action()
		self.hide()



class FullScreenSecretCodeCheckMenu(SecretCodeCheckMenu):
	def __init__(self, name, action=(lambda : None), cancel_action=(lambda : None), eventhandler=None, type='full_screen_secret_code', **kw):
		SecretCodeCheckMenu.__init__(self, name, action, cancel_action, eventhandler, type, **kw)



class QuestionAnswerCheckLauncher(object):
	def __init__(self, action, *args, **args):
		self.action = action
		self.args = args
		self.kw = kw
		self.countdown = range(1, 3)
		def check_answer(win):
			response = win.text
			if user_config['security']['answer'] == response:
				self.action(*self.args, **self.kw)
				win.hide()
			else:
				try:
					self.countdown.pop()
					win.text = ''
				except IndexError:
					win.hide()

		kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
		kbd.show()



class QuestionAnswerSetupParametersLauncher(object):
	__doc__ = "\n    This class sets up the algorithm for modify the Q/A in setup :\n        - check the current answer (if 'check' parameters is True)\n        - ask the new question\n        - ask the new answer\n        - then if no cancel, record the new question and the new answer\n    "
	def __init__(self, check=True, end_action=None, end_action_args=(), end_action_kw={}):
		self.countdown = range(1, 3)
		self._new_question = None
		self._new_response = None
		self.end_action = end_action
		self.end_action_args = end_action_args
		self.end_action_kw = end_action_kw
		def set_new_answer(win):
			self._new_response = win.text
			win.hide()
			self._set_new_values()

		def set_new_question(win):
			self._new_question = win.text
			win.hide()
			kbd = KeyboardWindow(title=_('Enter your answer'), confirm_action=set_new_answer)
			self._connect_cancel_button(kbd)
			kbd.show()

		def check_answer(win):
			response = win.text
			if user_config['security']['answer'] == response:
				win.hide()
				kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
				self._connect_cancel_button(kbd)
				kbd.show()
			else:
				win.text = ''
				try:
					self.countdown.pop()
				except IndexError:
					win.hide()

		if check:
			kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
		else:
			kbd = KeyboardWindow(title=_('Enter your question.  \nIt will be asked if you lose your secret code'), confirm_action=set_new_question)
			kbd.type = 'bigtitle_keyboard'
		self._connect_cancel_button(kbd)
		kbd.show()
		return None

	def _set_new_values(self):
		_question = self._new_question
		_response = self._new_response
		user_config['security']['question'] = _question
		user_config['security']['answer'] = _response
		user_config.save()
		if self.end_action is not None:
			self.end_action(*self.end_action_args, **self.end_action_kw)
		return None

	_on_cancel_firstboot = staticmethod()
	_connect_cancel_button = staticmethod()


]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76197cc>}
from __future__ import absolute_import
from .core import Menu
from pygui.item.core import Item
from pygui.eventmanager.menus import SecretCodeMenuEventHandler
from pygui.item.parameters.generalsetup.securitysetup import SecretCodeUserConfigSetupItem, SecretCodeCheckConfigSetupItem
from pygui.window import KeyboardWindow
from pygui.config import user_config
from pygui.shared import pygui_globs
from pygui.window import TextWindow
from peewee.notifier import Task
class SecretCodeCheckMenu(Menu):
	__doc__ = "\n    This Menu permits to check that entered secret code (by user) is the\n    same as the config's one.\n    The user has 3 tries to enter the good code\n    "
	def __init__(self, name, action=(lambda : None), cancel_action=(lambda : None), eventhandler=None, type='secret_code', **kw):
		Menu.__init__(self, name, choices=[], type=type, universe='parameters', **kw)
		if not eventhandler:
			pass
		self.eventhandler = eventhandler
		self.action = action
		self.cancel_action = cancel_action
		self.available_choices = ['options_list', 'main_list', 'options2_list', 'options3_list', 'options4_list']
		self.main_items = [SecretCodeCheckConfigSetupItem(name='SecretCode', menu=self, domain='security', key='secretcode')]
		self.prompt_items = [Item(name=_('Enter your current code'), type_='unknown')]
		self.message_window = TextWindow(_('Wrong PIN code'))
		for c in self.available_choices:
			def self._getitems_keywords[c](list_name=c):
				return self.get_item_list(list_name)

		self._browse_items()
		self.countdown = range(1, 3)

	def _browse_items(self, rank=0):
		items = self.main_items[rank].browse()
		prompt = self.prompt_items[rank]
		self.set_items([prompt], 'options_list')
		for browsed, list_name in zip(items, self.available_choices[1:]):
			self.set_items(browsed.browse(), list_name)
			self.get_item_list(list_name).cyclic = True

	def focus_previous(self):
		if self.active_list == 'main_list':
			self.hide()
		else:
			Menu.focus_previous(self)

	def _set_options_list(self, selection, keep_selection=False):
		if selection.check_entered_value():
			self.hide()
			self.action()
		else:
			try:
				remain = self.countdown.pop()
				self.message_window.show()
				Task(self.message_window.hide).start(2)
			except IndexError:
				self.cancel()
			else:
				self._browse_items()
				self.active_list = 'main_list'

	def cancel(self):
		self.cancel_action()
		self.hide()



class FullScreenSecretCodeCheckMenu(SecretCodeCheckMenu):
	def __init__(self, name, action=(lambda : None), cancel_action=(lambda : None), eventhandler=None, type='full_screen_secret_code', **kw):
		SecretCodeCheckMenu.__init__(self, name, action, cancel_action, eventhandler, type, **kw)



class QuestionAnswerCheckLauncher(object):
	def __init__(self, action, *args, **args):
		self.action = action
		self.args = args
		self.kw = kw
		self.countdown = range(1, 3)
		def check_answer(win):
			response = win.text
			if user_config['security']['answer'] == response:
				self.action(*self.args, **self.kw)
				win.hide()
			else:
				try:
					self.countdown.pop()
					win.text = ''
				except IndexError:
					win.hide()

		kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
		kbd.show()



class QuestionAnswerSetupParametersLauncher(object):
	__doc__ = "\n    This class sets up the algorithm for modify the Q/A in setup :\n        - check the current answer (if 'check' parameters is True)\n        - ask the new question\n        - ask the new answer\n        - then if no cancel, record the new question and the new answer\n    "
	def __init__(self, check=True, end_action=None, end_action_args=(), end_action_kw={}):
		self.countdown = range(1, 3)
		self._new_question = None
		self._new_response = None
		self.end_action = end_action
		self.end_action_args = end_action_args
		self.end_action_kw = end_action_kw
		def set_new_answer(win):
			self._new_response = win.text
			win.hide()
			self._set_new_values()

		def set_new_question(win):
			self._new_question = win.text
			win.hide()
			kbd = KeyboardWindow(title=_('Enter your answer'), confirm_action=set_new_answer)
			self._connect_cancel_button(kbd)
			kbd.show()

		def check_answer(win):
			response = win.text
			if user_config['security']['answer'] == response:
				win.hide()
				kbd = KeyboardWindow(title=_('Enter your question'), confirm_action=set_new_question)
				self._connect_cancel_button(kbd)
				kbd.show()
			else:
				win.text = ''
				try:
					self.countdown.pop()
				except IndexError:
					win.hide()

		if check:
			kbd = KeyboardWindow(title=user_config['security']['question'], confirm_action=check_answer)
		else:
			kbd = KeyboardWindow(title=_('Enter your question.  \nIt will be asked if you lose your secret code'), confirm_action=set_new_question)
			kbd.type = 'bigtitle_keyboard'
		self._connect_cancel_button(kbd)
		kbd.show()
		return None

	def _set_new_values(self):
		_question = self._new_question
		_response = self._new_response
		user_config['security']['question'] = _question
		user_config['security']['answer'] = _response
		user_config.save()
		if self.end_action is not None:
			self.end_action(*self.end_action_args, **self.end_action_kw)
		return None

	_on_cancel_firstboot = staticmethod()
	_connect_cancel_button = staticmethod()


